#!/usr/bin/env python
# -*- coding: UTF-8 -*-
'''
@Project ：图灵学习 
@File    ：19.代理.py
@IDE     ：PyCharm 
@Author  ：ChenLiGao
@Date    ：2024-11-20 15:14
'''
import requests


# http代理
ip = "127.0.0.1"
port = 7890

proxies = {
  "http": "http://%s:%d" %(ip, port),
  "https": "http://%s:%d" %(ip, port),
}

print(proxies)

headers = {
    "User-Agent": "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Mobile Safari/537.36 Edg/131.0.0.0"
}


url = "http://httpbin.org/ip"

response = requests.get(url, headers=headers, proxies=proxies, timeout=10)
print(response.text)